<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Get rollup index capabilities API | ElasticSearch 7.7 权威指南中文版</title>
	<meta name="keywords" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <meta name="description" content="ElasticSearch 权威指南中文版, elasticsearch 7, es7, 实时数据分析，实时数据检索" />
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/styles.css" />
	<script>
	var _link = 'rollup-get-rollup-index-caps.html';
    </script>
</head>
<body>
<div class="main-container">
    <section id="content">
        <div class="content-wrapper">
            <section id="guide" lang="zh_cn">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                            <div style="color:gray; word-break: break-all; font-size:12px;">原英文版地址: <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.7/rollup-get-rollup-index-caps.html" rel="nofollow" target="_blank">https://www.elastic.co/guide/en/elasticsearch/reference/7.7/rollup-get-rollup-index-caps.html</a>, 原文档版权归 www.elastic.co 所有<br/>本地英文版地址: <a href="../en/rollup-get-rollup-index-caps.html" rel="nofollow" target="_blank">../en/rollup-get-rollup-index-caps.html</a></div>
                        <!-- start body -->
                  <div class="page_header">
<strong>重要</strong>: 此版本不会发布额外的bug修复或文档更新。最新信息请参考 <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html" rel="nofollow">当前版本文档</a>。
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="rest-apis.html">REST APIs</a></span>
»
<span class="breadcrumb-link"><a href="rollup-apis.html">Rollup APIs</a></span>
»
<span class="breadcrumb-node">Get rollup index capabilities API</span>
</div>
<div class="navheader">
<span class="prev">
<a href="rollup-get-rollup-caps.html">« Get rollup job capabilities API</a>
</span>
<span class="next">
<a href="rollup-search.html">Rollup search »</a>
</span>
</div>
<div class="section xpack">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="rollup-get-rollup-index-caps"></a>Get rollup index capabilities API<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/rollup/apis/rollup-index-caps.asciidoc">edit</a><a class="xpack_tag" href="https://www.elastic.co/subscriptions"></a>
</h2>
</div></div></div>

<p>Returns the rollup capabilities of all jobs inside of a rollup index (e.g. the
index where rollup data is stored).</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features.</p>
</div>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="rollup-get-rollup-index-caps-request"></a>Request<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/rollup/apis/rollup-index-caps.asciidoc">edit</a>
</h3>
</div></div></div>
<p><code class="literal">GET &lt;index&gt;/_rollup/data</code></p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="rollup-get-rollup-index-caps-prereqs"></a>Prerequisites<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/rollup/apis/rollup-index-caps.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
If the Elasticsearch security features are enabled, you must have the <code class="literal">read</code> index
privilege on the index that stores the rollup results. For more information, see
<a class="xref" href="security-privileges.html" title="Security privileges">Security privileges</a>.
</li>
</ul>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="rollup-get-rollup-index-caps-desc"></a>Description<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/rollup/apis/rollup-index-caps.asciidoc">edit</a>
</h3>
</div></div></div>
<p>A single rollup index may store the data for multiple rollup jobs, and may
have a variety of capabilities depending on those jobs.</p>
<p>This API will allow you to determine:</p>
<div class="olist orderedlist">
<ol class="orderedlist">
<li class="listitem">
What jobs are stored in an index (or indices specified via a pattern)?
</li>
<li class="listitem">
What target indices were rolled up, what fields were used in those rollups
and what aggregations can be performed on each job?
</li>
</ol>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="rollup-get-rollup-index-caps-path-params"></a>Path parameters<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/rollup/apis/rollup-index-caps.asciidoc">edit</a>
</h3>
</div></div></div>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">&lt;index&gt;</code>
</span>
</dt>
<dd>
(Required, string) Index or index-pattern of concrete rollup indices to check
for capabilities.
</dd>
</dl>
</div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="rollup-get-rollup-index-caps-example"></a>Examples<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/rollup/apis/rollup-index-caps.asciidoc">edit</a>
</h3>
</div></div></div>
<p>Imagine we have an index named <code class="literal">sensor-1</code> full of raw data.  We know that the
data will grow over time, so there will be a <code class="literal">sensor-2</code>, <code class="literal">sensor-3</code>, etc.
Let’s create a rollup job that stores its data in <code class="literal">sensor_rollup</code>:</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT _rollup/job/sensor
{
    "index_pattern": "sensor-*",
    "rollup_index": "sensor_rollup",
    "cron": "*/30 * * * * ?",
    "page_size" :1000,
    "groups" : {
      "date_histogram": {
        "field": "timestamp",
        "fixed_interval": "1h",
        "delay": "7d"
      },
      "terms": {
        "fields": ["node"]
      }
    },
    "metrics": [
        {
            "field": "temperature",
            "metrics": ["min", "max", "sum"]
        },
        {
            "field": "voltage",
            "metrics": ["avg"]
        }
    ]
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/1876.console"></div>
<p>If at a later date, we’d like to determine what jobs and capabilities were
stored in the <code class="literal">sensor_rollup</code> index, we can use the get rollup index API:</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">GET /sensor_rollup/_rollup/data</pre>
</div>
<div class="console_widget" data-snippet="snippets/1877.console"></div>
<p>Note how we are requesting the concrete rollup index name (<code class="literal">sensor_rollup</code>) as
the first part of the URL. This  will yield the following response:</p>
<div class="pre_wrapper lang-console-result">
<pre class="programlisting prettyprint lang-console-result">{
  "sensor_rollup" : {
    "rollup_jobs" : [
      {
        "job_id" : "sensor",
        "rollup_index" : "sensor_rollup",
        "index_pattern" : "sensor-*",
        "fields" : {
          "node" : [
            {
              "agg" : "terms"
            }
          ],
          "temperature" : [
            {
              "agg" : "min"
            },
            {
              "agg" : "max"
            },
            {
              "agg" : "sum"
            }
          ],
          "timestamp" : [
            {
              "agg" : "date_histogram",
              "time_zone" : "UTC",
              "fixed_interval" : "1h",
              "delay": "7d"
            }
          ],
          "voltage" : [
            {
              "agg" : "avg"
            }
          ]
        }
      }
    ]
  }
}</pre>
</div>
<p>The response that is returned contains information that is similar to the
original rollup configuration, but formatted differently. First, there are some
house-keeping details: the rollup job ID, the index that holds the rolled data,
the index pattern that the job was targeting.</p>
<p>Next it shows a list of fields that contain data eligible for rollup searches.
Here we see four fields: <code class="literal">node</code>, <code class="literal">temperature</code>, <code class="literal">timestamp</code> and <code class="literal">voltage</code>. Each
of these fields list the aggregations that are possible. For example, you can
use a min, max, or sum aggregation on the <code class="literal">temperature</code> field, but only a
<code class="literal">date_histogram</code> on <code class="literal">timestamp</code>.</p>
<p>Note that the <code class="literal">rollup_jobs</code> element is an array; there can be multiple,
independent jobs configured for a single index or index pattern. Each of these
jobs may have different configurations, so the API returns a list of all the
various configurations available.</p>
<p>Like other APIs that interact with indices, you can specify index patterns
instead of explicit indices:</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">GET /*_rollup/_rollup/data</pre>
</div>
<div class="console_widget" data-snippet="snippets/1878.console"></div>
</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="rollup-get-rollup-caps.html">« Get rollup job capabilities API</a>
</span>
<span class="next">
<a href="rollup-search.html">Rollup search »</a>
</span>
</div>
</div>

                  <!-- end body -->
                        </div>
                        <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                        
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<script src="../static/cn.js"></script>
</body>
</html>